const projectId = require('../../package.json').projectId
const version = require('../../package.json').version
// localStorage name
const lsn = `${projectId}_${version && version.replace(/\./g, '-')}`
// 记录页面加载次数
export function recorder(store) {
  const lsStr = localStorage.getItem(lsn)
  let lsObj = {}
  try {
    lsObj = JSON.parse(lsStr) || {}
  } catch (error) {}
  if (Object.keys(lsObj).length === 0) {
    store.commit('updateLoadTimes', 0)
  } else {
    store.commit('updateLoadTimes')
  }
}
